package com.wc.fortnight_blue_bridge.Q240127.Q12421;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/27 19:21
 * @description https://www.lanqiao.cn/problems/12421/learning/?contest_id=166
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = (int) 1e5 + 10;
    static int[] a = new int[N];
    static int n, q;
    static int l, r;
    static int[] tmp = new int[N];

    public static void main(String[] args) {
        n = sc.nextInt();
        q = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt();
        }
        while (q-- > 0) {
            l = sc.nextInt();
            r = sc.nextInt();
            if (r - l + 1 >= 101) {
                out.println("YES");
            } else {
                for (int j = l; j <= r; j++) {
                    tmp[j] = a[j];
                }
                Arrays.sort(tmp, l, r + 1);
                boolean flg = false;
                for (int i = l + 1; i <= r; i++) {
                    if (tmp[i] - tmp[i - 1] <= 365) {
                        flg = true;
                        break;
                    }
                }
                if (flg) {
                    out.println("YES");
                } else {
                    out.println("NO");
                }
            }
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}